<?php
$queryStr =$this->shopHelper()->pagesQuery();
$params = isset($this->params) ? $this->params : [];
?>

<?php if ($this->pageCount): ?>
    <div class="xm-pagenavi">
        <?php if (isset($this->previous)): ?>
            <a href="<?php echo $this->url($this->route, $params, ['query'=>['page'=>$this->previous]]) . $queryStr; ?>" class="numbers first iconfont"></a>
        <?php else: ?>
            <span class="numbers first iconfont"></span>
        <?php endif; ?>

        <?php foreach ($this->pagesInRange as $page): ?>
            <?php if ($page != $this->current): ?>
                <a class="numbers current" href="<?php echo $this->url($this->route, $params, ['query'=>['page'=>$page]]) . $queryStr; ?>">
                    <?php echo $this->escapeHtml($page); ?>
                </a>
            <?php else: ?>
                <span class="numbers current">
                <?php echo $this->escapeHtml($page); ?>
            </span>
            <?php endif; ?>
        <?php endforeach; ?>

        <?php if (isset($this->next)): ?>
            <a href="<?php echo $this->url($this->route, $params, ['query'=>['page'=>$this->next]]) . $queryStr; ?>" class="numbers last iconfont"></a>
        <?php else: ?>
            <span class="numbers last iconfont"></span>
        <?php endif; ?>

    </div>
<?php endif; ?>